<template>
	<uni-collapse-item :show-arrow="false" title-border="show" :open="open">
		<slot></slot>
		<template #title>
			<view class="uni-collapse-item-title" :style="{background:backgroundColor}">
				<text>{{ title }}</text>
				<image :src="`/static/images/device-manage/icon-${suffix}.png`" />
			</view>
		</template>
	</uni-collapse-item>
</template>
<script>
	export default {
		props: {
			title: String,
			index: String,
			indexList: {
				type: Array,
				default: () => []
			},
			open: {
				type: Boolean,
				default: true
			},
			backgroundColor: {
				type: String,
				default: '#24f5f5'
			}
		},
		computed: {
			suffix() {
				return this.indexList.includes(this.index) ? 'up' : 'down'
			}
		}
	}
</script>
<style lang="scss" scoped>
	.uni-collapse-item {
		margin-bottom: 20rpx;
	}

	.uni-collapse-item-title {
		border-radius: 20rpx 20rpx 0 0;
		background: rgb(194, 192, 138);
		padding: 20rpx 30rpx;
		box-sizing: border-box;
		font-size: 31rpx;
		font-family: PingFang SC-Regular, PingFang SC;
		font-weight: 400;
		color: #f9f9f9;
		display: flex;
		align-items: center;
		justify-content: space-between;
		height: 90rpx;

		image {
			width: 50rpx;
			height: 50rpx;
		}
	}
</style>